<cfcomponent displayname="AgenciesGateway" output="false">
	<cffunction name="init" access="public" output="false" returntype="AgenciesGateway">
		<cfargument name="dsn" type="string" required="true" />
		<cfset variables.dsn = arguments.dsn />
		<cfreturn this />
	</cffunction>
    
    <cffunction name="getAgencySelect" access="public" output="false" returntype="query">
		<cfargument name="id" type="numeric" required="false" />
		<cfargument name="name" type="string" required="false" />
		<cfargument name="orderby" type="string" required="false" default="name" />
        
        <cfset var qList = "" />		
		<cfquery name="qList" datasource="#variables.dsn#">
			SELECT
				id,
				name
        	FROM	agencies
			WHERE	0=0
		
		<cfif structKeyExists(arguments,"id") and len(arguments.id)>
			AND	id = <cfqueryparam value="#arguments.id#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"name") and len(arguments.name)>
			AND	name = <cfqueryparam value="#arguments.name#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments, "orderby") and len(arguments.orderBy)>
			ORDER BY #arguments.orderby#
		</cfif>
		</cfquery>
		
		<cfreturn qList />
	</cffunction>
	
	<cffunction name="getByAttributesQuery" access="public" output="false" returntype="query">
		<cfargument name="id" type="numeric" required="false" />
		<cfargument name="name" type="string" required="false" />
		<cfargument name="address1" type="string" required="false" />
		<cfargument name="address2" type="string" required="false" />
		<cfargument name="city" type="string" required="false" />
		<cfargument name="state" type="string" required="false" />
		<cfargument name="zipCode" type="string" required="false" />
		<cfargument name="location" type="string" required="false" />
		<cfargument name="phone" type="string" required="false" />
		<cfargument name="fax" type="string" required="false" />
		<cfargument name="website" type="string" required="false" />
		<cfargument name="acceptUGJunior" type="numeric" required="false" />
		<cfargument name="acceptUGSenior" type="numeric" required="false" />
		<cfargument name="acceptFirstYear" type="numeric" required="false" />
		<cfargument name="acceptSecondYear" type="numeric" required="false" />
		<cfargument name="totalStudents" type="string" required="false" />
		<cfargument name="agencyPractice" type="string" required="false" />
		<cfargument name="servicesProvided" type="string" required="false" />
		<cfargument name="theoryBase" type="string" required="false" />
		<cfargument name="macroArea" type="string" required="false" />
		<cfargument name="clinicalArea" type="string" required="false" />
		<cfargument name="other" type="string" required="false" />
		<cfargument name="stipend" type="string" required="false" />
		<cfargument name="forProfit" type="boolean" required="false" />
		<cfargument name="clinical" type="boolean" required="false" />
		<cfargument name="foundation" type="boolean" required="false" />
		<cfargument name="macro" type="boolean" required="false" />
		<cfargument name="combined" type="boolean" required="false" />
		<cfargument name="health" type="boolean" required="false" />
		<cfargument name="metro" type="boolean" required="false" />
		<cfargument name="carLicense" type="boolean" required="false" />
		<cfargument name="foriegnLanguage" type="boolean" required="false" />
		<cfargument name="flexTime" type="boolean" required="false" />
		<cfargument name="handicapAccessible" type="boolean" required="false" />
		<cfargument name="faithBased" type="boolean" required="false" />
		<cfargument name="affiliationAgreement" type="boolean" required="false" />
		<cfargument name="fwsAgreement" type="boolean" required="false" />
		<cfargument name="agencyProfile" type="boolean" required="false" />
		<cfargument name="multipleSites" type="boolean" required="false" />
		<cfargument name="dateNinetyNine" type="date" required="false" />
		<cfargument name="datePhoneInformationReceived" type="date" required="false" />
		<cfargument name="dateOfAffiliation" type="date" required="false" />
		<cfargument name="dateOfVisit" type="date" required="false" />
		<cfargument name="backgroundDrugScreening" type="boolean" required="false" />
		<cfargument name="backgroundChildAbuse" type="boolean" required="false" />
		<cfargument name="backgroundImmunizationVerification" type="boolean" required="false" />
		<cfargument name="backgroundLiabilityVerification" type="boolean" required="false" />
		<cfargument name="backgroundSpecialApplication" type="boolean" required="false" />
		<cfargument name="backgroundReferenceLetters" type="boolean" required="false" />
		<cfargument name="backgroundFingerprinting" type="boolean" required="false" />
		<cfargument name="backgroundPoliceClearance" type="boolean" required="false" />
		<cfargument name="backgroundTBScreen" type="boolean" required="false" />
		<cfargument name="backgroundOther" type="string" required="false" />
		<cfargument name="backgroundRequiredDays" type="string" required="false" />
		<cfargument name="ageGroupAdults" type="boolean" required="false" />
		<cfargument name="ageGroupOlderAdults" type="boolean" required="false" />
		<cfargument name="ageGroupAdolescents" type="boolean" required="false" />
		<cfargument name="ageGroupFamilies" type="boolean" required="false" />
		<cfargument name="ageGroupChildren0to5" type="boolean" required="false" />
		<cfargument name="ageGroupChildren6to12" type="boolean" required="false" />
		<cfargument name="comments" type="string" required="false" />
		<cfargument name="needsLongForm" type="boolean" required="false" />
		<cfargument name="currentlyActive" type="boolean" required="false" />
		<cfargument name="doNotUse" type="boolean" required="false" />
		<cfargument name="agencyFlag" type="boolean" required="false" />
		<cfargument name="typeOfSetting" type="string" required="false" />
		<cfargument name="privateComments" type="string" required="false" />
		<cfargument name="leAdministration" type="numeric" required="false" />
		<cfargument name="leAdvocacy" type="numeric" required="false" />
		<cfargument name="leCaseManagement" type="numeric" required="false" />
		<cfargument name="leClinicalCaseManagement" type="numeric" required="false" />
		<cfargument name="leCommOrganization" type="numeric" required="false" />
		<cfargument name="leCrisisIntervention" type="numeric" required="false" />
		<cfargument name="leDischargePlanning" type="numeric" required="false" />
		<cfargument name="leFamilyTreatment" type="numeric" required="false" />
		<cfargument name="leGroupTreatment" type="numeric" required="false" />
		<cfargument name="leIndWithAdult" type="numeric" required="false" />
		<cfargument name="leIndWithChildren" type="numeric" required="false" />
		<cfargument name="leIndWithAdolescents" type="numeric" required="false" />
		<cfargument name="lePolicyAnalysis" type="numeric" required="false" />
		<cfargument name="leProgramPlanning" type="numeric" required="false" />
		<cfargument name="leProgramManagement" type="numeric" required="false" />
		<cfargument name="leResearch" type="numeric" required="false" />
		<cfargument name="leOther1" type="string" required="false" />
		<cfargument name="leOther2" type="string" required="false" />
		<cfargument name="tbCogBehavioral" type="boolean" required="false" />
		<cfargument name="tbCommTheory" type="boolean" required="false" />
		<cfargument name="tbCommDevelopment" type="boolean" required="false" />
		<cfargument name="tbContingency" type="boolean" required="false" />
		<cfargument name="tbCrisis" type="boolean" required="false" />
		<cfargument name="tbEcological" type="boolean" required="false" />
		<cfargument name="tbEmpowerment" type="boolean" required="false" />
		<cfargument name="tbExchange" type="boolean" required="false" />
		<cfargument name="tbFamilyTherapy" type="boolean" required="false" />
		<cfargument name="tbFeminist" type="boolean" required="false" />
		<cfargument name="tbPowerDependence" type="boolean" required="false" />
		<cfargument name="tbPsychodynamic" type="boolean" required="false" />
		<cfargument name="tbPsychosocial" type="boolean" required="false" />
		<cfargument name="tbSolution" type="boolean" required="false" />
		<cfargument name="tbSystems" type="boolean" required="false" />
		<cfargument name="tbTranspersonal" type="boolean" required="false" />
		<cfargument name="lobbying" type="boolean" required="false" />
		<cfargument name="nonProfit" type="boolean" required="false" />
		<cfargument name="agencyPublic" type="boolean" required="false" />
		<cfargument name="agencyPrivate" type="boolean" required="false" />
		<cfargument name="federal" type="boolean" required="false" />
		<cfargument name="stateCounty" type="boolean" required="false" />
		<cfargument name="communityBased" type="boolean" required="false" />
		<cfargument name="undergraduateJunior" type="boolean" required="false" />
		<cfargument name="ataother" type="string" required="false" />
		<cfargument name="adultsRank" type="numeric" required="false" />
		<cfargument name="olderAdultsRank" type="numeric" required="false" />
		<cfargument name="adolescentsRank" type="numeric" required="false" />
		<cfargument name="familiesRank" type="numeric" required="false" />
		<cfargument name="children0to5Rank" type="numeric" required="false" />
		<cfargument name="children6to12Rank" type="numeric" required="false" />
		<cfargument name="multiple" type="string" required="false" />
		<cfargument name="isPrivate" type="boolean" required="false" />
		<cfargument name="isPublic" type="boolean" required="false" />
		<cfargument name="completedDate" type="date" required="false" />
		<cfargument name="completedName" type="string" required="false" />
		<cfargument name="completedEmail" type="string" required="false" />
		<cfargument name="undergraduateSenior" type="boolean" required="false" />
		<cfargument name="transport" type="boolean" required="false" />
		<cfargument name="backgroundMedicalExam" type="boolean" required="false" />
		<cfargument name="tHomeVisits" type="boolean" required="false" />
		<cfargument name="tDriversLicense" type="boolean" required="false" />
		<cfargument name="tAutomobile" type="boolean" required="false" />
		<cfargument name="tAgencyVehicle" type="boolean" required="false" />
		<cfargument name="tOwnVehicle" type="boolean" required="false" />
		<cfargument name="tCovered" type="boolean" required="false" />
		<cfargument name="tOther" type="string" required="false" />
		<cfargument name="mpPolicyAnalysis" type="numeric" required="false" />
		<cfargument name="mpAdvocacy" type="numeric" required="false" />
		<cfargument name="mpCommOrganization" type="numeric" required="false" />
		<cfargument name="mpManagement" type="numeric" required="false" />
		<cfargument name="mpAdministration" type="numeric" required="false" />
		<cfargument name="mpPlanning" type="numeric" required="false" />
		<cfargument name="mpEvalResearch" type="numeric" required="false" />
		<cfargument name="comments2" type="string" required="false" />
		<cfargument name="notSureYet" type="boolean" required="false" />
		<cfargument name="flexHours" type="string" required="false" />
		<cfargument name="leIndWithAdultAdd" type="string" required="false" />
		<cfargument name="leIndWithChildrenAdd" type="string" required="false" />
		<cfargument name="leIndWithAdolescentsAdd" type="string" required="false" />
		<cfargument name="foreignLanguagePreferred" type="boolean" required="false" />
		<cfargument name="orderby" type="string" required="false" />
		
		<cfset var qList = "" />		
		<cfquery name="qList" datasource="#variables.dsn#">
			SELECT
				id,
				name,
				address1,
				address2,
				city,
				state,
				zipCode,
				location,
				phone,
				fax,
				website,
				acceptUGJunior,
				acceptUGSenior,
				acceptFirstYear,
				acceptSecondYear,
				totalStudents,
				agencyPractice,
				servicesProvided,
				theoryBase,
				macroArea,
				clinicalArea,
				other,
				stipend,
				forProfit,
				clinical,
				foundation,
				macro,
				combined,
				health,
				metro,
				carLicense,
				foriegnLanguage,
				flexTime,
				handicapAccessible,
				faithBased,
				affiliationAgreement,
				fwsAgreement,
				agencyProfile,
				multipleSites,
				dateNinetyNine,
				datePhoneInformationReceived,
				dateOfAffiliation,
				dateOfVisit,
				backgroundDrugScreening,
				backgroundChildAbuse,
				backgroundImmunizationVerification,
				backgroundLiabilityVerification,
				backgroundSpecialApplication,
				backgroundReferenceLetters,
				backgroundFingerprinting,
				backgroundPoliceClearance,
				backgroundTBScreen,
				backgroundOther,
				backgroundRequiredDays,
				ageGroupAdults,
				ageGroupOlderAdults,
				ageGroupAdolescents,
				ageGroupFamilies,
				ageGroupChildren0to5,
				ageGroupChildren6to12,
				comments,
				needsLongForm,
				currentlyActive,
				doNotUse,
				agencyFlag,
				typeOfSetting,
				privateComments,
				leAdministration,
				leAdvocacy,
				leCaseManagement,
				leClinicalCaseManagement,
				leCommOrganization,
				leCrisisIntervention,
				leDischargePlanning,
				leFamilyTreatment,
				leGroupTreatment,
				leIndWithAdult,
				leIndWithChildren,
				leIndWithAdolescents,
				lePolicyAnalysis,
				leProgramPlanning,
				leProgramManagement,
				leResearch,
				leOther1,
				leOther2,
				tbCogBehavioral,
				tbCommTheory,
				tbCommDevelopment,
				tbContingency,
				tbCrisis,
				tbEcological,
				tbEmpowerment,
				tbExchange,
				tbFamilyTherapy,
				tbFeminist,
				tbPowerDependence,
				tbPsychodynamic,
				tbPsychosocial,
				tbSolution,
				tbSystems,
				tbTranspersonal,
				lobbying,
				nonProfit,
				agencyPublic,
				agencyPrivate,
				federal,
				stateCounty,
				communityBased,
				undergraduateJunior,
				ataother,
				adultsRank,
				olderAdultsRank,
				adolescentsRank,
				familiesRank,
				children0to5Rank,
				children6to12Rank,
				multiple,
				isPrivate,
				isPublic,
				completedDate,
				completedName,
				completedEmail,
				undergraduateSenior,
				transport,
				backgroundMedicalExam,
				tHomeVisits,
				tDriversLicense,
				tAutomobile,
				tAgencyVehicle,
				tOwnVehicle,
				tCovered,
				tOther,
				mpPolicyAnalysis,
				mpAdvocacy,
				mpCommOrganization,
				mpManagement,
				mpAdministration,
				mpPlanning,
				mpEvalResearch,
				comments2,
				notSureYet,
				flexHours,
				leIndWithAdultAdd,
				leIndWithChildrenAdd,
				leIndWithAdolescentsAdd,
				foreignLanguagePreferred
			FROM	agencies
			WHERE	0=0
		
		<cfif structKeyExists(arguments,"id") and len(arguments.id)>
			AND	id = <cfqueryparam value="#arguments.id#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"name") and len(arguments.name)>
			AND	name = <cfqueryparam value="#arguments.name#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"address1") and len(arguments.address1)>
			AND	address1 = <cfqueryparam value="#arguments.address1#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"address2") and len(arguments.address2)>
			AND	address2 = <cfqueryparam value="#arguments.address2#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"city") and len(arguments.city)>
			AND	city = <cfqueryparam value="#arguments.city#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"state") and len(arguments.state)>
			AND	state = <cfqueryparam value="#arguments.state#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"zipCode") and len(arguments.zipCode)>
			AND	zipCode = <cfqueryparam value="#arguments.zipCode#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"location") and len(arguments.location)>
			AND	location = <cfqueryparam value="#arguments.location#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"phone") and len(arguments.phone)>
			AND	phone = <cfqueryparam value="#arguments.phone#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"fax") and len(arguments.fax)>
			AND	fax = <cfqueryparam value="#arguments.fax#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"website") and len(arguments.website)>
			AND	website = <cfqueryparam value="#arguments.website#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"acceptUGJunior") and len(arguments.acceptUGJunior)>
			AND	acceptUGJunior = <cfqueryparam value="#arguments.acceptUGJunior#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"acceptUGSenior") and len(arguments.acceptUGSenior)>
			AND	acceptUGSenior = <cfqueryparam value="#arguments.acceptUGSenior#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"acceptFirstYear") and len(arguments.acceptFirstYear)>
			AND	acceptFirstYear = <cfqueryparam value="#arguments.acceptFirstYear#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"acceptSecondYear") and len(arguments.acceptSecondYear)>
			AND	acceptSecondYear = <cfqueryparam value="#arguments.acceptSecondYear#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"totalStudents") and len(arguments.totalStudents)>
			AND	totalStudents = <cfqueryparam value="#arguments.totalStudents#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"agencyPractice") and len(arguments.agencyPractice)>
			AND	agencyPractice = <cfqueryparam value="#arguments.agencyPractice#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"servicesProvided") and len(arguments.servicesProvided)>
			AND	servicesProvided = <cfqueryparam value="#arguments.servicesProvided#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"theoryBase") and len(arguments.theoryBase)>
			AND	theoryBase = <cfqueryparam value="#arguments.theoryBase#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"macroArea") and len(arguments.macroArea)>
			AND	macroArea = <cfqueryparam value="#arguments.macroArea#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"clinicalArea") and len(arguments.clinicalArea)>
			AND	clinicalArea = <cfqueryparam value="#arguments.clinicalArea#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"other") and len(arguments.other)>
			AND	other = <cfqueryparam value="#arguments.other#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"stipend") and len(arguments.stipend)>
			AND	stipend = <cfqueryparam value="#arguments.stipend#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"forProfit") and len(arguments.forProfit)>
			AND	forProfit = <cfqueryparam value="#arguments.forProfit#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"clinical") and len(arguments.clinical)>
			AND	clinical = <cfqueryparam value="#arguments.clinical#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"foundation") and len(arguments.foundation)>
			AND	foundation = <cfqueryparam value="#arguments.foundation#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"macro") and len(arguments.macro)>
			AND	macro = <cfqueryparam value="#arguments.macro#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"combined") and len(arguments.combined)>
			AND	combined = <cfqueryparam value="#arguments.combined#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"health") and len(arguments.health)>
			AND	health = <cfqueryparam value="#arguments.health#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"metro") and len(arguments.metro)>
			AND	metro = <cfqueryparam value="#arguments.metro#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"carLicense") and len(arguments.carLicense)>
			AND	carLicense = <cfqueryparam value="#arguments.carLicense#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"foriegnLanguage") and len(arguments.foriegnLanguage)>
			AND	foriegnLanguage = <cfqueryparam value="#arguments.foriegnLanguage#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"flexTime") and len(arguments.flexTime)>
			AND	flexTime = <cfqueryparam value="#arguments.flexTime#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"handicapAccessible") and len(arguments.handicapAccessible)>
			AND	handicapAccessible = <cfqueryparam value="#arguments.handicapAccessible#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"faithBased") and len(arguments.faithBased)>
			AND	faithBased = <cfqueryparam value="#arguments.faithBased#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"affiliationAgreement") and len(arguments.affiliationAgreement)>
			AND	affiliationAgreement = <cfqueryparam value="#arguments.affiliationAgreement#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"fwsAgreement") and len(arguments.fwsAgreement)>
			AND	fwsAgreement = <cfqueryparam value="#arguments.fwsAgreement#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"agencyProfile") and len(arguments.agencyProfile)>
			AND	agencyProfile = <cfqueryparam value="#arguments.agencyProfile#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"multipleSites") and len(arguments.multipleSites)>
			AND	multipleSites = <cfqueryparam value="#arguments.multipleSites#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"dateNinetyNine") and len(arguments.dateNinetyNine)>
			AND	dateNinetyNine = <cfqueryparam value="#arguments.dateNinetyNine#" CFSQLType="cf_sql_timestamp" />
		</cfif>
		<cfif structKeyExists(arguments,"datePhoneInformationReceived") and len(arguments.datePhoneInformationReceived)>
			AND	datePhoneInformationReceived = <cfqueryparam value="#arguments.datePhoneInformationReceived#" CFSQLType="cf_sql_timestamp" />
		</cfif>
		<cfif structKeyExists(arguments,"dateOfAffiliation") and len(arguments.dateOfAffiliation)>
			AND	dateOfAffiliation = <cfqueryparam value="#arguments.dateOfAffiliation#" CFSQLType="cf_sql_timestamp" />
		</cfif>
		<cfif structKeyExists(arguments,"dateOfVisit") and len(arguments.dateOfVisit)>
			AND	dateOfVisit = <cfqueryparam value="#arguments.dateOfVisit#" CFSQLType="cf_sql_timestamp" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundDrugScreening") and len(arguments.backgroundDrugScreening)>
			AND	backgroundDrugScreening = <cfqueryparam value="#arguments.backgroundDrugScreening#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundChildAbuse") and len(arguments.backgroundChildAbuse)>
			AND	backgroundChildAbuse = <cfqueryparam value="#arguments.backgroundChildAbuse#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundImmunizationVerification") and len(arguments.backgroundImmunizationVerification)>
			AND	backgroundImmunizationVerification = <cfqueryparam value="#arguments.backgroundImmunizationVerification#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundLiabilityVerification") and len(arguments.backgroundLiabilityVerification)>
			AND	backgroundLiabilityVerification = <cfqueryparam value="#arguments.backgroundLiabilityVerification#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundSpecialApplication") and len(arguments.backgroundSpecialApplication)>
			AND	backgroundSpecialApplication = <cfqueryparam value="#arguments.backgroundSpecialApplication#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundReferenceLetters") and len(arguments.backgroundReferenceLetters)>
			AND	backgroundReferenceLetters = <cfqueryparam value="#arguments.backgroundReferenceLetters#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundFingerprinting") and len(arguments.backgroundFingerprinting)>
			AND	backgroundFingerprinting = <cfqueryparam value="#arguments.backgroundFingerprinting#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundPoliceClearance") and len(arguments.backgroundPoliceClearance)>
			AND	backgroundPoliceClearance = <cfqueryparam value="#arguments.backgroundPoliceClearance#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundTBScreen") and len(arguments.backgroundTBScreen)>
			AND	backgroundTBScreen = <cfqueryparam value="#arguments.backgroundTBScreen#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundOther") and len(arguments.backgroundOther)>
			AND	backgroundOther = <cfqueryparam value="#arguments.backgroundOther#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundRequiredDays") and len(arguments.backgroundRequiredDays)>
			AND	backgroundRequiredDays = <cfqueryparam value="#arguments.backgroundRequiredDays#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"ageGroupAdults") and len(arguments.ageGroupAdults)>
			AND	ageGroupAdults = <cfqueryparam value="#arguments.ageGroupAdults#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"ageGroupOlderAdults") and len(arguments.ageGroupOlderAdults)>
			AND	ageGroupOlderAdults = <cfqueryparam value="#arguments.ageGroupOlderAdults#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"ageGroupAdolescents") and len(arguments.ageGroupAdolescents)>
			AND	ageGroupAdolescents = <cfqueryparam value="#arguments.ageGroupAdolescents#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"ageGroupFamilies") and len(arguments.ageGroupFamilies)>
			AND	ageGroupFamilies = <cfqueryparam value="#arguments.ageGroupFamilies#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"ageGroupChildren0to5") and len(arguments.ageGroupChildren0to5)>
			AND	ageGroupChildren0to5 = <cfqueryparam value="#arguments.ageGroupChildren0to5#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"ageGroupChildren6to12") and len(arguments.ageGroupChildren6to12)>
			AND	ageGroupChildren6to12 = <cfqueryparam value="#arguments.ageGroupChildren6to12#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"comments") and len(arguments.comments)>
			AND	comments = <cfqueryparam value="#arguments.comments#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"needsLongForm") and len(arguments.needsLongForm)>
			AND	needsLongForm = <cfqueryparam value="#arguments.needsLongForm#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"currentlyActive") and len(arguments.currentlyActive)>
			AND	currentlyActive = <cfqueryparam value="#arguments.currentlyActive#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"doNotUse") and len(arguments.doNotUse)>
			AND	doNotUse = <cfqueryparam value="#arguments.doNotUse#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"agencyFlag") and len(arguments.agencyFlag)>
			AND	agencyFlag = <cfqueryparam value="#arguments.agencyFlag#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"typeOfSetting") and len(arguments.typeOfSetting)>
			AND	typeOfSetting = <cfqueryparam value="#arguments.typeOfSetting#" CFSQLType="cf_sql_char" />
		</cfif>
		<cfif structKeyExists(arguments,"privateComments") and len(arguments.privateComments)>
			AND	privateComments = <cfqueryparam value="#arguments.privateComments#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"leAdministration") and len(arguments.leAdministration)>
			AND	leAdministration = <cfqueryparam value="#arguments.leAdministration#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leAdvocacy") and len(arguments.leAdvocacy)>
			AND	leAdvocacy = <cfqueryparam value="#arguments.leAdvocacy#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leCaseManagement") and len(arguments.leCaseManagement)>
			AND	leCaseManagement = <cfqueryparam value="#arguments.leCaseManagement#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leClinicalCaseManagement") and len(arguments.leClinicalCaseManagement)>
			AND	leClinicalCaseManagement = <cfqueryparam value="#arguments.leClinicalCaseManagement#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leCommOrganization") and len(arguments.leCommOrganization)>
			AND	leCommOrganization = <cfqueryparam value="#arguments.leCommOrganization#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leCrisisIntervention") and len(arguments.leCrisisIntervention)>
			AND	leCrisisIntervention = <cfqueryparam value="#arguments.leCrisisIntervention#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leDischargePlanning") and len(arguments.leDischargePlanning)>
			AND	leDischargePlanning = <cfqueryparam value="#arguments.leDischargePlanning#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leFamilyTreatment") and len(arguments.leFamilyTreatment)>
			AND	leFamilyTreatment = <cfqueryparam value="#arguments.leFamilyTreatment#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leGroupTreatment") and len(arguments.leGroupTreatment)>
			AND	leGroupTreatment = <cfqueryparam value="#arguments.leGroupTreatment#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leIndWithAdult") and len(arguments.leIndWithAdult)>
			AND	leIndWithAdult = <cfqueryparam value="#arguments.leIndWithAdult#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leIndWithChildren") and len(arguments.leIndWithChildren)>
			AND	leIndWithChildren = <cfqueryparam value="#arguments.leIndWithChildren#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leIndWithAdolescents") and len(arguments.leIndWithAdolescents)>
			AND	leIndWithAdolescents = <cfqueryparam value="#arguments.leIndWithAdolescents#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"lePolicyAnalysis") and len(arguments.lePolicyAnalysis)>
			AND	lePolicyAnalysis = <cfqueryparam value="#arguments.lePolicyAnalysis#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leProgramPlanning") and len(arguments.leProgramPlanning)>
			AND	leProgramPlanning = <cfqueryparam value="#arguments.leProgramPlanning#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leProgramManagement") and len(arguments.leProgramManagement)>
			AND	leProgramManagement = <cfqueryparam value="#arguments.leProgramManagement#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leResearch") and len(arguments.leResearch)>
			AND	leResearch = <cfqueryparam value="#arguments.leResearch#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"leOther1") and len(arguments.leOther1)>
			AND	leOther1 = <cfqueryparam value="#arguments.leOther1#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"leOther2") and len(arguments.leOther2)>
			AND	leOther2 = <cfqueryparam value="#arguments.leOther2#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"tbCogBehavioral") and len(arguments.tbCogBehavioral)>
			AND	tbCogBehavioral = <cfqueryparam value="#arguments.tbCogBehavioral#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbCommTheory") and len(arguments.tbCommTheory)>
			AND	tbCommTheory = <cfqueryparam value="#arguments.tbCommTheory#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbCommDevelopment") and len(arguments.tbCommDevelopment)>
			AND	tbCommDevelopment = <cfqueryparam value="#arguments.tbCommDevelopment#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbContingency") and len(arguments.tbContingency)>
			AND	tbContingency = <cfqueryparam value="#arguments.tbContingency#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbCrisis") and len(arguments.tbCrisis)>
			AND	tbCrisis = <cfqueryparam value="#arguments.tbCrisis#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbEcological") and len(arguments.tbEcological)>
			AND	tbEcological = <cfqueryparam value="#arguments.tbEcological#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbEmpowerment") and len(arguments.tbEmpowerment)>
			AND	tbEmpowerment = <cfqueryparam value="#arguments.tbEmpowerment#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbExchange") and len(arguments.tbExchange)>
			AND	tbExchange = <cfqueryparam value="#arguments.tbExchange#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbFamilyTherapy") and len(arguments.tbFamilyTherapy)>
			AND	tbFamilyTherapy = <cfqueryparam value="#arguments.tbFamilyTherapy#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbFeminist") and len(arguments.tbFeminist)>
			AND	tbFeminist = <cfqueryparam value="#arguments.tbFeminist#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbPowerDependence") and len(arguments.tbPowerDependence)>
			AND	tbPowerDependence = <cfqueryparam value="#arguments.tbPowerDependence#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbPsychodynamic") and len(arguments.tbPsychodynamic)>
			AND	tbPsychodynamic = <cfqueryparam value="#arguments.tbPsychodynamic#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbPsychosocial") and len(arguments.tbPsychosocial)>
			AND	tbPsychosocial = <cfqueryparam value="#arguments.tbPsychosocial#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbSolution") and len(arguments.tbSolution)>
			AND	tbSolution = <cfqueryparam value="#arguments.tbSolution#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbSystems") and len(arguments.tbSystems)>
			AND	tbSystems = <cfqueryparam value="#arguments.tbSystems#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tbTranspersonal") and len(arguments.tbTranspersonal)>
			AND	tbTranspersonal = <cfqueryparam value="#arguments.tbTranspersonal#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"lobbying") and len(arguments.lobbying)>
			AND	lobbying = <cfqueryparam value="#arguments.lobbying#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"nonProfit") and len(arguments.nonProfit)>
			AND	nonProfit = <cfqueryparam value="#arguments.nonProfit#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"agencyPublic") and len(arguments.agencyPublic)>
			AND	agencyPublic = <cfqueryparam value="#arguments.agencyPublic#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"agencyPrivate") and len(arguments.agencyPrivate)>
			AND	agencyPrivate = <cfqueryparam value="#arguments.agencyPrivate#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"federal") and len(arguments.federal)>
			AND	federal = <cfqueryparam value="#arguments.federal#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"stateCounty") and len(arguments.stateCounty)>
			AND	stateCounty = <cfqueryparam value="#arguments.stateCounty#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"communityBased") and len(arguments.communityBased)>
			AND	communityBased = <cfqueryparam value="#arguments.communityBased#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"undergraduateJunior") and len(arguments.undergraduateJunior)>
			AND	undergraduateJunior = <cfqueryparam value="#arguments.undergraduateJunior#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"ataother") and len(arguments.ataother)>
			AND	ataother = <cfqueryparam value="#arguments.ataother#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"adultsRank") and len(arguments.adultsRank)>
			AND	adultsRank = <cfqueryparam value="#arguments.adultsRank#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"olderAdultsRank") and len(arguments.olderAdultsRank)>
			AND	olderAdultsRank = <cfqueryparam value="#arguments.olderAdultsRank#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"adolescentsRank") and len(arguments.adolescentsRank)>
			AND	adolescentsRank = <cfqueryparam value="#arguments.adolescentsRank#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"familiesRank") and len(arguments.familiesRank)>
			AND	familiesRank = <cfqueryparam value="#arguments.familiesRank#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"children0to5Rank") and len(arguments.children0to5Rank)>
			AND	children0to5Rank = <cfqueryparam value="#arguments.children0to5Rank#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"children6to12Rank") and len(arguments.children6to12Rank)>
			AND	children6to12Rank = <cfqueryparam value="#arguments.children6to12Rank#" CFSQLType="cf_sql_integer" />
		</cfif>
		<cfif structKeyExists(arguments,"multiple") and len(arguments.multiple)>
			AND	multiple = <cfqueryparam value="#arguments.multiple#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"isPrivate") and len(arguments.isPrivate)>
			AND	isPrivate = <cfqueryparam value="#arguments.isPrivate#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"isPublic") and len(arguments.isPublic)>
			AND	isPublic = <cfqueryparam value="#arguments.isPublic#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"completedDate") and len(arguments.completedDate)>
			AND	completedDate = <cfqueryparam value="#arguments.completedDate#" CFSQLType="cf_sql_timestamp" />
		</cfif>
		<cfif structKeyExists(arguments,"completedName") and len(arguments.completedName)>
			AND	completedName = <cfqueryparam value="#arguments.completedName#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"completedEmail") and len(arguments.completedEmail)>
			AND	completedEmail = <cfqueryparam value="#arguments.completedEmail#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"undergraduateSenior") and len(arguments.undergraduateSenior)>
			AND	undergraduateSenior = <cfqueryparam value="#arguments.undergraduateSenior#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"transport") and len(arguments.transport)>
			AND	transport = <cfqueryparam value="#arguments.transport#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"backgroundMedicalExam") and len(arguments.backgroundMedicalExam)>
			AND	backgroundMedicalExam = <cfqueryparam value="#arguments.backgroundMedicalExam#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tHomeVisits") and len(arguments.tHomeVisits)>
			AND	tHomeVisits = <cfqueryparam value="#arguments.tHomeVisits#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tDriversLicense") and len(arguments.tDriversLicense)>
			AND	tDriversLicense = <cfqueryparam value="#arguments.tDriversLicense#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tAutomobile") and len(arguments.tAutomobile)>
			AND	tAutomobile = <cfqueryparam value="#arguments.tAutomobile#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tAgencyVehicle") and len(arguments.tAgencyVehicle)>
			AND	tAgencyVehicle = <cfqueryparam value="#arguments.tAgencyVehicle#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tOwnVehicle") and len(arguments.tOwnVehicle)>
			AND	tOwnVehicle = <cfqueryparam value="#arguments.tOwnVehicle#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tCovered") and len(arguments.tCovered)>
			AND	tCovered = <cfqueryparam value="#arguments.tCovered#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"tOther") and len(arguments.tOther)>
			AND	tOther = <cfqueryparam value="#arguments.tOther#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"mpPolicyAnalysis") and len(arguments.mpPolicyAnalysis)>
			AND	mpPolicyAnalysis = <cfqueryparam value="#arguments.mpPolicyAnalysis#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"mpAdvocacy") and len(arguments.mpAdvocacy)>
			AND	mpAdvocacy = <cfqueryparam value="#arguments.mpAdvocacy#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"mpCommOrganization") and len(arguments.mpCommOrganization)>
			AND	mpCommOrganization = <cfqueryparam value="#arguments.mpCommOrganization#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"mpManagement") and len(arguments.mpManagement)>
			AND	mpManagement = <cfqueryparam value="#arguments.mpManagement#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"mpAdministration") and len(arguments.mpAdministration)>
			AND	mpAdministration = <cfqueryparam value="#arguments.mpAdministration#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"mpPlanning") and len(arguments.mpPlanning)>
			AND	mpPlanning = <cfqueryparam value="#arguments.mpPlanning#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"mpEvalResearch") and len(arguments.mpEvalResearch)>
			AND	mpEvalResearch = <cfqueryparam value="#arguments.mpEvalResearch#" CFSQLType="cf_sql_tinyint" />
		</cfif>
		<cfif structKeyExists(arguments,"comments2") and len(arguments.comments2)>
			AND	comments2 = <cfqueryparam value="#arguments.comments2#" CFSQLType="cf_sql_longvarchar" />
		</cfif>
		<cfif structKeyExists(arguments,"notSureYet") and len(arguments.notSureYet)>
			AND	notSureYet = <cfqueryparam value="#arguments.notSureYet#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments,"flexHours") and len(arguments.flexHours)>
			AND	flexHours = <cfqueryparam value="#arguments.flexHours#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"leIndWithAdultAdd") and len(arguments.leIndWithAdultAdd)>
			AND	leIndWithAdultAdd = <cfqueryparam value="#arguments.leIndWithAdultAdd#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"leIndWithChildrenAdd") and len(arguments.leIndWithChildrenAdd)>
			AND	leIndWithChildrenAdd = <cfqueryparam value="#arguments.leIndWithChildrenAdd#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"leIndWithAdolescentsAdd") and len(arguments.leIndWithAdolescentsAdd)>
			AND	leIndWithAdolescentsAdd = <cfqueryparam value="#arguments.leIndWithAdolescentsAdd#" CFSQLType="cf_sql_varchar" />
		</cfif>
		<cfif structKeyExists(arguments,"foreignLanguagePreferred") and len(arguments.foreignLanguagePreferred)>
			AND	foreignLanguagePreferred = <cfqueryparam value="#arguments.foreignLanguagePreferred#" CFSQLType="cf_sql_bit" />
		</cfif>
		<cfif structKeyExists(arguments, "orderby") and len(arguments.orderBy)>
			ORDER BY #arguments.orderby#
		</cfif>
		</cfquery>
		
		<cfreturn qList />
	</cffunction>

	<cffunction name="getByAttributes" access="public" output="false" returntype="array">
		<cfargument name="id" type="numeric" required="false" />
		<cfargument name="name" type="string" required="false" />
		<cfargument name="address1" type="string" required="false" />
		<cfargument name="address2" type="string" required="false" />
		<cfargument name="city" type="string" required="false" />
		<cfargument name="state" type="string" required="false" />
		<cfargument name="zipCode" type="string" required="false" />
		<cfargument name="location" type="string" required="false" />
		<cfargument name="phone" type="string" required="false" />
		<cfargument name="fax" type="string" required="false" />
		<cfargument name="website" type="string" required="false" />
		<cfargument name="acceptUGJunior" type="numeric" required="false" />
		<cfargument name="acceptUGSenior" type="numeric" required="false" />
		<cfargument name="acceptFirstYear" type="numeric" required="false" />
		<cfargument name="acceptSecondYear" type="numeric" required="false" />
		<cfargument name="totalStudents" type="string" required="false" />
		<cfargument name="agencyPractice" type="string" required="false" />
		<cfargument name="servicesProvided" type="string" required="false" />
		<cfargument name="theoryBase" type="string" required="false" />
		<cfargument name="macroArea" type="string" required="false" />
		<cfargument name="clinicalArea" type="string" required="false" />
		<cfargument name="other" type="string" required="false" />
		<cfargument name="stipend" type="string" required="false" />
		<cfargument name="forProfit" type="boolean" required="false" />
		<cfargument name="clinical" type="boolean" required="false" />
		<cfargument name="foundation" type="boolean" required="false" />
		<cfargument name="macro" type="boolean" required="false" />
		<cfargument name="combined" type="boolean" required="false" />
		<cfargument name="health" type="boolean" required="false" />
		<cfargument name="metro" type="boolean" required="false" />
		<cfargument name="carLicense" type="boolean" required="false" />
		<cfargument name="foriegnLanguage" type="boolean" required="false" />
		<cfargument name="flexTime" type="boolean" required="false" />
		<cfargument name="handicapAccessible" type="boolean" required="false" />
		<cfargument name="faithBased" type="boolean" required="false" />
		<cfargument name="affiliationAgreement" type="boolean" required="false" />
		<cfargument name="fwsAgreement" type="boolean" required="false" />
		<cfargument name="agencyProfile" type="boolean" required="false" />
		<cfargument name="multipleSites" type="boolean" required="false" />
		<cfargument name="dateNinetyNine" type="date" required="false" />
		<cfargument name="datePhoneInformationReceived" type="date" required="false" />
		<cfargument name="dateOfAffiliation" type="date" required="false" />
		<cfargument name="dateOfVisit" type="date" required="false" />
		<cfargument name="backgroundDrugScreening" type="boolean" required="false" />
		<cfargument name="backgroundChildAbuse" type="boolean" required="false" />
		<cfargument name="backgroundImmunizationVerification" type="boolean" required="false" />
		<cfargument name="backgroundLiabilityVerification" type="boolean" required="false" />
		<cfargument name="backgroundSpecialApplication" type="boolean" required="false" />
		<cfargument name="backgroundReferenceLetters" type="boolean" required="false" />
		<cfargument name="backgroundFingerprinting" type="boolean" required="false" />
		<cfargument name="backgroundPoliceClearance" type="boolean" required="false" />
		<cfargument name="backgroundTBScreen" type="boolean" required="false" />
		<cfargument name="backgroundOther" type="string" required="false" />
		<cfargument name="backgroundRequiredDays" type="string" required="false" />
		<cfargument name="ageGroupAdults" type="boolean" required="false" />
		<cfargument name="ageGroupOlderAdults" type="boolean" required="false" />
		<cfargument name="ageGroupAdolescents" type="boolean" required="false" />
		<cfargument name="ageGroupFamilies" type="boolean" required="false" />
		<cfargument name="ageGroupChildren0to5" type="boolean" required="false" />
		<cfargument name="ageGroupChildren6to12" type="boolean" required="false" />
		<cfargument name="comments" type="string" required="false" />
		<cfargument name="needsLongForm" type="boolean" required="false" />
		<cfargument name="currentlyActive" type="boolean" required="false" />
		<cfargument name="doNotUse" type="boolean" required="false" />
		<cfargument name="agencyFlag" type="boolean" required="false" />
		<cfargument name="typeOfSetting" type="string" required="false" />
		<cfargument name="privateComments" type="string" required="false" />
		<cfargument name="leAdministration" type="numeric" required="false" />
		<cfargument name="leAdvocacy" type="numeric" required="false" />
		<cfargument name="leCaseManagement" type="numeric" required="false" />
		<cfargument name="leClinicalCaseManagement" type="numeric" required="false" />
		<cfargument name="leCommOrganization" type="numeric" required="false" />
		<cfargument name="leCrisisIntervention" type="numeric" required="false" />
		<cfargument name="leDischargePlanning" type="numeric" required="false" />
		<cfargument name="leFamilyTreatment" type="numeric" required="false" />
		<cfargument name="leGroupTreatment" type="numeric" required="false" />
		<cfargument name="leIndWithAdult" type="numeric" required="false" />
		<cfargument name="leIndWithChildren" type="numeric" required="false" />
		<cfargument name="leIndWithAdolescents" type="numeric" required="false" />
		<cfargument name="lePolicyAnalysis" type="numeric" required="false" />
		<cfargument name="leProgramPlanning" type="numeric" required="false" />
		<cfargument name="leProgramManagement" type="numeric" required="false" />
		<cfargument name="leResearch" type="numeric" required="false" />
		<cfargument name="leOther1" type="string" required="false" />
		<cfargument name="leOther2" type="string" required="false" />
		<cfargument name="tbCogBehavioral" type="boolean" required="false" />
		<cfargument name="tbCommTheory" type="boolean" required="false" />
		<cfargument name="tbCommDevelopment" type="boolean" required="false" />
		<cfargument name="tbContingency" type="boolean" required="false" />
		<cfargument name="tbCrisis" type="boolean" required="false" />
		<cfargument name="tbEcological" type="boolean" required="false" />
		<cfargument name="tbEmpowerment" type="boolean" required="false" />
		<cfargument name="tbExchange" type="boolean" required="false" />
		<cfargument name="tbFamilyTherapy" type="boolean" required="false" />
		<cfargument name="tbFeminist" type="boolean" required="false" />
		<cfargument name="tbPowerDependence" type="boolean" required="false" />
		<cfargument name="tbPsychodynamic" type="boolean" required="false" />
		<cfargument name="tbPsychosocial" type="boolean" required="false" />
		<cfargument name="tbSolution" type="boolean" required="false" />
		<cfargument name="tbSystems" type="boolean" required="false" />
		<cfargument name="tbTranspersonal" type="boolean" required="false" />
		<cfargument name="lobbying" type="boolean" required="false" />
		<cfargument name="nonProfit" type="boolean" required="false" />
		<cfargument name="agencyPublic" type="boolean" required="false" />
		<cfargument name="agencyPrivate" type="boolean" required="false" />
		<cfargument name="federal" type="boolean" required="false" />
		<cfargument name="stateCounty" type="boolean" required="false" />
		<cfargument name="communityBased" type="boolean" required="false" />
		<cfargument name="undergraduateJunior" type="boolean" required="false" />
		<cfargument name="ataother" type="string" required="false" />
		<cfargument name="adultsRank" type="numeric" required="false" />
		<cfargument name="olderAdultsRank" type="numeric" required="false" />
		<cfargument name="adolescentsRank" type="numeric" required="false" />
		<cfargument name="familiesRank" type="numeric" required="false" />
		<cfargument name="children0to5Rank" type="numeric" required="false" />
		<cfargument name="children6to12Rank" type="numeric" required="false" />
		<cfargument name="multiple" type="string" required="false" />
		<cfargument name="isPrivate" type="boolean" required="false" />
		<cfargument name="isPublic" type="boolean" required="false" />
		<cfargument name="completedDate" type="date" required="false" />
		<cfargument name="completedName" type="string" required="false" />
		<cfargument name="completedEmail" type="string" required="false" />
		<cfargument name="undergraduateSenior" type="boolean" required="false" />
		<cfargument name="transport" type="boolean" required="false" />
		<cfargument name="backgroundMedicalExam" type="boolean" required="false" />
		<cfargument name="tHomeVisits" type="boolean" required="false" />
		<cfargument name="tDriversLicense" type="boolean" required="false" />
		<cfargument name="tAutomobile" type="boolean" required="false" />
		<cfargument name="tAgencyVehicle" type="boolean" required="false" />
		<cfargument name="tOwnVehicle" type="boolean" required="false" />
		<cfargument name="tCovered" type="boolean" required="false" />
		<cfargument name="tOther" type="string" required="false" />
		<cfargument name="mpPolicyAnalysis" type="numeric" required="false" />
		<cfargument name="mpAdvocacy" type="numeric" required="false" />
		<cfargument name="mpCommOrganization" type="numeric" required="false" />
		<cfargument name="mpManagement" type="numeric" required="false" />
		<cfargument name="mpAdministration" type="numeric" required="false" />
		<cfargument name="mpPlanning" type="numeric" required="false" />
		<cfargument name="mpEvalResearch" type="numeric" required="false" />
		<cfargument name="comments2" type="string" required="false" />
		<cfargument name="notSureYet" type="boolean" required="false" />
		<cfargument name="flexHours" type="string" required="false" />
		<cfargument name="leIndWithAdultAdd" type="string" required="false" />
		<cfargument name="leIndWithChildrenAdd" type="string" required="false" />
		<cfargument name="leIndWithAdolescentsAdd" type="string" required="false" />
		<cfargument name="foreignLanguagePreferred" type="boolean" required="false" />
		<cfargument name="orderby" type="string" required="false" />
		
		<cfset var qList = getByAttributesQuery(argumentCollection=arguments) />		
		<cfset var arrObjects = arrayNew(1) />
		<cfset var tmpObj = "" />
		<cfset var i = 0 />
		<cfloop from="1" to="#qList.recordCount#" index="i">
			<cfset tmpObj = createObject("component","Agencies").init(argumentCollection=queryRowToStruct(qList,i)) />
			<cfset arrayAppend(arrObjects,tmpObj) />
		</cfloop>
				
		<cfreturn arrObjects />
	</cffunction>

	<cffunction name="queryRowToStruct" access="private" output="false" returntype="struct">
		<cfargument name="qry" type="query" required="true">
		
		<cfscript>
			/**
			 * Makes a row of a query into a structure.
			 * 
			 * @param query 	 The query to work with. 
			 * @param row 	 Row number to check. Defaults to row 1. 
			 * @return Returns a structure. 
			 * @author Nathan Dintenfass (nathan@changemedia.com) 
			 * @version 1, December 11, 2001 
			 */
			//by default, do this to the first row of the query
			var row = 1;
			//a var for looping
			var ii = 1;
			//the cols to loop over
			var cols = listToArray(qry.columnList);
			//the struct to return
			var stReturn = structnew();
			//if there is a second argument, use that for the row number
			if(arrayLen(arguments) GT 1)
				row = arguments[2];
			//loop over the cols and build the struct from the query row
			for(ii = 1; ii lte arraylen(cols); ii = ii + 1){
				stReturn[cols[ii]] = qry[cols[ii]][row];
			}		
			//return the struct
			return stReturn;
		</cfscript>
	</cffunction>

</cfcomponent>
